Skip to content

Conversation

@RaHehl
Copy link

@RaHehl RaHehl commented Oct 30, 2025

Add ability to pass LaunchOptions directly via ConnectOptions instead of manually constructing JSON headers.

The implementation automatically serializes launchOptions to the x-playwright-launch-options header when provided.

Motivation / Use case

When running the browser inside a container and connecting remotely (see Playwright docs: Remote connection with Docker), it’s currently cumbersome to specify the browser channel.

current:
connectOptions.headers.put("x-playwright-launch-options", "{\"channel\":\"msedge\"}");
which you have to discover first

Proposed API (Java)

browserType.connect("ws://localhost:3000/ws",
          new BrowserType.ConnectOptions().setLaunchOptions(
            new BrowserType.LaunchOptions().setChannel("msedge")));

Add ability to pass LaunchOptions directly via ConnectOptions instead of
manually constructing JSON headers. This provides a type-safe and convenient
way to specify launch options like browser channel when connecting to a
remote browser.

The implementation automatically serializes launchOptions to the
x-playwright-launch-options header when provided.
@RaHehl
Copy link
Author

RaHehl commented Oct 30, 2025

@microsoft-github-policy-service agree

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is generated from https://github.com/microsoft/playwright/blob/main/docs/src/api/class-browsertype.md, please don't edit it manually. I also suggest you start with filing a new issue in https://github.com/microsoft/playwright with a description of the problem.

x-playwright-launch-options is currently a private property. If we want to expose it in the API it should be available in other ports too, in Node.js in the first place. Let's assess the use case first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants